<template>
	<view style="padding-top: 20rpx;">
		<view class="scan-box" @tap="toScan">
			<text style="font-size: 40rpx;">扫码认证</text>
			<u-icon name="scan" color="#2e8bf0" size="48px"></u-icon>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				
			}
		},
		methods: {
			toScan(){
				uni.scanCode({
					scanType:['qrCode'],
					success:(res)=>{
						if(res.result.indexOf('&goods_id=')==-1){
							uni.showToast({
								icon:'none',
								title:'非程序内二维码无法扫描'
							})
						}else{
							const _id = res.result.split('&goods_id=')[1].split('&')[0]
							uni.navigateTo({
								url:`/pages/stashresult/stashresult?id=${_id}`
							})
						}
						
					}
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.scan-box{
		width: 700rpx;
		height: 280rpx;
		border: 4rpx solid #2e8bf0;
		border-radius: 10rpx;
		display: flex;
		justify-content: space-between;
		align-items: center;
		margin: 0 auto;
		box-sizing: border-box;
		padding: 0 30rpx;
	}

</style>
